﻿<%@ Page AutoEventWireup="true" CodeFile="Default.aspx.cs" Debug="true" Inherits="_Default"
    Language="C#" ValidateRequest="false" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">

<meta http-equiv="Page-Enter" content="progid:DXImageTransform.Microsoft.RandomDissolve(Duration=1)">
<meta http-equiv="Page-Exit" content="progid:DXImageTransform.Microsoft.RandomDissolve(Duration=1)">

    <title>自动化图书信息采集系统</title>
    
    <link id="skin" type="text/css" rel="stylesheet" href="css/skin.css" />
    <link id="Link1" type="text/css" rel="stylesheet" href="css/textbox.css" />

    <script language="javascript">
function dhCombobox(){
 //author:dh20156;
 var dh = this;

 //返回实例名
 this.clsName = null;

 //定义目标对象
 this.targetObj = null;

 //定义提示框属性
 this.popWidth = 0;
 this.popHeight = 100;

 //定义数据源（数组）
 this.arrayData = [];

 //定义匹配后的结果
 var nowHtml = null;

 //定义当前选定的结果
 var i_selected = 0;

 //定义光标键所在的位置
 var i_move = i_selected;

 //匹配用户输入字符结果
 Array.prototype.contains = function(o) {
  var tc = [];
  var nc = 0;
  for(var i = 0, l = this.length; i < l; i++) {
   if(this[i].name.indexOf(o) >= 0){
    if(this[i].name.indexOf(";") >= 0){
     var tempData = this[i].split(";");
     tc[nc++] = "<DIV id='cdiv"+nc+"' value=\""+tempData[1]+"\" onmouseover=\"parent."+dh.clsName+".mouse_over(this);\" onmouseout=\"parent."+dh.clsName+".mouse_out(this);\" onclick=\"parent."+dh.clsName+".select(this);\">"+tempData[0]+"</DIV>";
    }else{
     tc[nc++] = "<DIV id='cdiv"+nc+"' code=\""+this[i].code+"\" value=\""+this[i].name+"\" onmouseover=\"parent."+dh.clsName+".mouse_over(this);\" onmouseout=\"parent."+dh.clsName+".mouse_out(this);\" onclick=\"parent."+dh.clsName+".select(this);parent."+dh.clsName+".txtNumChange(this);\">"+this[i].name+"</DIV>";
    }
    nc++;
   }
  }
  if(nc>0){
   nowHtml = tc.join("");
   tc = null;
  }else{
   nowHtml = "";
  }
 }

 //匹配
 function searchKey(){
  var begin = new Date().getTime();
  var str = dh.targetObj.value;
  //if(str.replace(/\s/g,"") != ""){
   dh.arrayData.contains(str);
   showPop(nowHtml);
   i_selected = 1;
   getFocus();
  //}else{
  // if(dhpop.isOpen){
  //  dhpop.hide();
  // }
  //}
  
   if(dhpop.isOpen){
    dhpop.hide();
   }
 }

 //按键处理
 function pressKey(){
  var kc = event.keyCode;
  var obj = dhpop.document.all.fdiv;
  if(obj == "[object]"){
   var objcl = obj.childNodes.length;
   switch(kc){
    case 13: //回车
     if(i_move > 0){
      var oldchild = obj.childNodes[i_move-1];
      dh.select(oldchild);
      i_selected = i_move;
      dh.targetObj.blur();
     }
     break;
    case 33: //PgUp
     obj.doScroll("scrollbarPageUp");
     break;
    case 34: //PgDn
     obj.doScroll("scrollbarPageDown");
     break;
    case 38: //上箭头
     if(objcl > 0 && i_move > 0){

      if(i_move > 1){
       var oldchild = obj.childNodes[i_move-1];
       oldchild.style.background = "";
       oldchild.style.color = "";
      }

      if(i_move > 1){
       var objchild = obj.childNodes[i_move-2];
       objchild.style.background = "highlight";
       objchild.style.color = "highlighttext";
       if(obj.scrollTop >= objchild.offsetTop){
        objchild.scrollIntoView(true);
       }
      }

      if(i_move > 2){
       i_move--;
      }else{
       i_move = 1;
      }
      }
     break;
    case 40: //下箭头
     if(objcl > 0 && i_move <= objcl){

      if(i_move > 0 && i_move < objcl){
       var oldchild = obj.childNodes[i_move-1];
       oldchild.style.background = "";
       oldchild.style.color = "";
      }

      if(i_move < objcl){
       var objchild = obj.childNodes[i_move];
       objchild.style.background = "highlight";
       objchild.style.color = "highlighttext";
       if(obj.scrollTop+dh.popHeight-objchild.offsetHeight-1 <= objchild.offsetTop){
        objchild.scrollIntoView(true);
       }
      }

      if(i_move < objcl){
       i_move++;
      }
     }
     break;
    default : //其他键
     if(!dhpop.isOpen){
      if(nowHtml != null){
       showPop(nowHtml);
      }else{
       showPop(popHtml);
      }
     }
     i_move = 0;
     break;
   }
  }
 }

 //选择匹配结果
 this.select = function(obj){
  this.targetObj.value = obj.value;
  dhpop.hide();
  this.targetObj.blur();
  i_selected = 1;
 }

 //鼠标指向匹配结果事件
 this.mouse_over = function(obj){
  obj.style.background = "highlight";
  obj.style.color = "highlighttext";
 }

 //鼠标离开匹配结果事件
 this.mouse_out = function(obj){
  obj.style.background = "";
  obj.style.color = "";
 }
this.txtNumChange = function(obj){   
var value = obj.value;
var code = obj.getAttribute("code");
     document.getElementById("txtNum").value = code;
      }
 //定义提示框
 var dhpop = window.createPopup();

 //弹出提示框
 function showPop(str){
  var objstr = dh.targetObj.value;
  //if(objstr.replace(/\s/g,"") != ""){
   var dhpopBody = dhpop.document.body;

   if(str != null){
    dhpopBody.innerHTML = "<DIV id=\"fdiv\" style=\"width:"+(dh.popWidth-1)+";height:"+(dh.popHeight-1)+";overflow-y:auto;overflow-x:auto;cursor:default;\" onselectstart=\"return false\" oncontextmenu=\"return false\">"+str+"</DIV>";
   }else{
    dhpopBody.innerHTML = "";
   }

   if(!dhpop.isOpen){
    var popObj = dh.targetObj;
    var popLeft = 2;
    var popTop = popObj.clientHeight+4;
    var popWidth = dh.popWidth;
    var popHeight = dh.popHeight;
    dhpopBody.style.border = "1px solid buttonshadow";
    dhpopBody.style.background = "white";
    dhpopBody.style.fontFamily = "arial";
    dhpopBody.style.fontSize = "12px";
    dhpopBody.style.scrollbarFaceColor = "white";
    dhpopBody.style.scrollbarShadowColor = "white";
    dhpopBody.style.scrollbarBaseColor = "buttonface";
    dhpopBody.style.scrollbarTrackColor = "black";
    dhpopBody.style.scrollbarHighlightColor = "white";
    dhpopBody.style.scrollbarDarkShadowColor = "buttonshadow";
    dhpop.show(popLeft,popTop,popWidth,popHeight,popObj);
   }
 // }
 }

 //获得选择的结果焦点
 function getFocus(){
  if(dhpop.isOpen){
   var obj = dhpop.document.all.fdiv;
   if(obj == "[object]"){
    var objcl = obj.childNodes.length;
    if(i_selected > 0 && objcl>0 && i_selected <= objcl){
     var objchild = obj.childNodes[i_selected-1];
     objchild.style.background = "highlight";
     objchild.style.color = "highlighttext";
     objchild.scrollIntoView(true);
     i_move = i_selected;
    }
    if(objcl == 1){
     var objchild = obj.childNodes[0];
     objchild.style.background = "highlight";
     objchild.style.color = "highlighttext";
     objchild.scrollIntoView(true);
     i_move = i_selected;
    }
   }
  }
 }

 //对象实例化
 this.setup = function(){
  if(this.popWidth == 0){
   this.popWidth = this.targetObj.clientWidth;
  }
  var targetObj = this.targetObj;
  targetObj.onclick = function(){showPop(nowHtml);getFocus();}
  targetObj.onkeydown = function(){pressKey();}
  targetObj.onpropertychange = function(){searchKey();}
 }
}
    </script>

    <script type="text/javascript">
    
    function load()
    {
        document.getElementById("Select1").value=document.getElementById("saved").value;
        changeskin();
    }
    
    function changeskin()
    {
        var skin=document.getElementById("Select1").value;
        document.getElementById("header").className=skin;
        document.getElementById("main").className=skin;
        document.getElementById("footer").className=skin;
        document.getElementById("saved").value=skin;
    }
    
    function download()
    {
        var link=document.getElementById("HyperLink1");
        link.click();
    }
    
    function sAlert()
    { 
       var msgw,msgh,bordercolor; 
       msgw=400;//Width
       msgh=100;//Height 
       titleheight=25 //title Height
       bordercolor="#336699";//boder color
       titlecolor="#99CCFF";//title color
       var sWidth,sHeight; 
       sWidth=document.body.offsetWidth; 
       sHeight=screen.height; 
       var bgObj=document.createElement("div"); 
       bgObj.setAttribute('id','bgDiv'); 
       bgObj.style.position="absolute"; 
       bgObj.style.top="0"; 
       bgObj.style.background="#777"; 
       bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75"; 
       bgObj.style.opacity="0.6"; 
       bgObj.style.left="0"; 
       bgObj.style.width=sWidth + "px"; 
       bgObj.style.height=sHeight + "px"; 
       bgObj.style.zIndex = "10000"; 
       document.body.appendChild(bgObj); 
       var msgObj=document.createElement("div") 
       msgObj.setAttribute("id","msgDiv"); 
       msgObj.setAttribute("align","center"); 
       msgObj.style.background="white"; 
       msgObj.style.border="1px solid " + bordercolor; 
       msgObj.style.position = "absolute"; 
       msgObj.style.left = "50%"; 
       msgObj.style.top = "50%"; 
       msgObj.style.font="12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif"; 
       msgObj.style.marginLeft = "-225px" ; 
       msgObj.style.marginTop = -75+document.documentElement.scrollTop+"px"; 
       msgObj.style.width = msgw + "px"; 
       msgObj.style.height =msgh + "px"; 
       msgObj.style.textAlign = "center"; 
       msgObj.style.lineHeight ="25px"; 
       msgObj.style.zIndex = "10001"; 
       var title=document.createElement("h4"); 
       title.setAttribute("id","msgTitle"); 
       title.setAttribute("align","right"); 
       title.style.margin="0"; 
       title.style.padding="3px"; 
       title.style.background=bordercolor; 
       title.style.filter="progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100);"; 
       title.style.opacity="0.75"; 
       title.style.border="1px solid " + bordercolor; 
       title.style.height="18px"; 
       title.style.font="12px Verdana, Geneva, Arial, Helvetica, sans-serif"; 
       title.style.color="white"; 
       title.style.cursor="pointer"; 
       title.innerHTML="Close"; 
       title.onclick=function(){ 
              document.body.removeChild(bgObj); 
              document.getElementById("msgDiv").removeChild(title); 
              document.body.removeChild(msgObj); 
            } 
       document.body.appendChild(msgObj); 
       document.getElementById("msgDiv").appendChild(title); 
       var txt=document.createElement("p"); 
       txt.style.margin="1em 0" 
       txt.setAttribute("id","msgTxt"); 
       txt.innerHTML="正在获取，请等待..."; 
       document.getElementById("msgDiv").appendChild(txt); 
    }
    
    </script>

</head>
<body onload="load();">
    <form id="form1" runat="server">
    <div id="header" style="text-align: center;" class="skin1">
        <br />
        <input id="isbn" runat="server" type="text" value="" 
            class="tb-bg-side" />
        <input id="Btn" runat="server" onserverclick="Btn_ServerClick" onclick="sAlert();" type="button" value="查  询" /><br />
        &nbsp;
    </div>
    <div id="main" style="text-align: center;" class="skin1">
        <table style="width: 80%; text-align: left; vertical-align: text-top;">
            <tr>
                <td style="height: 18px; width: 56px;">
                    &nbsp;
                </td>
                <td style="height: 18px; width: 68px;">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td>
                    编&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 号：<asp:TextBox ID="txtNum" runat="server"></asp:TextBox>
                </td>
                <td>
                    ISBN / ISSN：
                    <asp:TextBox ID="txtISBN" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    书&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 名：<asp:TextBox ID="txtTitle" runat="server"
                        Width="439px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    作&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 者：<asp:TextBox ID="txtAuthor" runat="server"
                        Width="439px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    价&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 格：<asp:TextBox ID="txtPrice" runat="server"></asp:TextBox>
                </td>
                <td>
                    出 &nbsp; 版 &nbsp;社：&nbsp;<asp:TextBox ID="txtPublisher" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    分&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 类：<asp:TextBox ID="ddlClass" runat="server"></asp:TextBox>
                </td>
                 <td>
                    购 入 日 期：&nbsp;<asp:TextBox ID="txtBuyDate" runat="server"></asp:TextBox>
                </td>               
                <%--<td>
                    类&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 型：
                    <asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
                </td>--%>
            </tr>
            <tr>
                <td>
                    出 版 日 期：<asp:TextBox ID="txtPublishDate" runat="server"></asp:TextBox>
                </td>
                <td>
                    总 &nbsp; 册 &nbsp;数：&nbsp;<asp:TextBox ID="txtCount" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    语&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 种：<asp:DropDownList ID="ddlLanguage" runat="server" CssClass="textboxbk" Width="55%">
                    </asp:DropDownList>                    
                    <%--<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>--%>
                </td>

            </tr>
            <tr valign='top'>
                <td colspan="2" valign="top">
                    内 容 介 绍：<asp:TextBox ID="txtContent" runat="server" Height="200px" TextMode="MultiLine"
                        Width="480px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td style="height: 18px; width: 56px;">
                    &nbsp;
                </td>
                <td style="height: 18px; width: 68px;">
                    &nbsp;
                </td>
            </tr>
        </table>
    </div>
    <div id="footer" style="text-align: center;" class="skin1">
        <br />选择主题：  
        <select title="切换主题可避免长时间操作产生疲劳" id="Select1" name="D1" onchange="changeskin();">
            <option value="skin1">主题一</option>
            <option value="skin2">主题二</option>
            <option value="skin3">主题三</option>
            <option value="skin4">主题四</option>
            <option value="skin5">主题五</option>
            <option value="skin6">主题六</option>
            <option value="skin7">主题七</option>
            <option value="skin8">主题八</option>
            <option value="skin9">主题九</option>
            <option value="skin10">主题十</option>
            <option value="skin11">主题十一</option>
            <option value="skin12">主题十二</option>
            <option value="skin13">主题十三</option>
            <option value="skin14">主题十四</option>
            <option value="skin15">主题十五</option>
            <option value="skin16">主题十六</option>
        </select>
        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;保存图书：<asp:HyperLink ID="HyperLink1" runat="server" style="display:none" Target="_blank" ImageUrl="~/images/save.png">保存</asp:HyperLink>
        <asp:ImageButton ID="btnSaveInputToDB" ImageUrl="~/images/save.png"
                runat="server" OnClick="btnSaveInputToDB_Click" ToolTip="保存图书入库记录" />
                
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;取消录入：
        <input id="BtnColse" style="display: none" runat="server" onserverclick="BtnClose_ServerClick"
            type="button" value="取消" /><asp:ImageButton ID="ImageButton2" ImageUrl="~/images/close.png"
                runat="server" OnClick="ImageButton2_Click" ToolTip="取消录入" />
                
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;下载XML存档：<input id="BtnSave" style="display: none" runat="server" onserverclick="BtnSave_ServerClick"
            type="button" value="保存" /><asp:ImageButton ID="ImageButton1" ImageUrl="~/images/create.png"
                runat="server" OnClick="ImageButton1_Click" ToolTip="下载XML存档" />
        <br />
        <br />
        <asp:HiddenField ID="book_uuid" runat="server" />
    </div>
   <input id="saved" runat="server" type="hidden" value="skin1" />
    </form>
</body>

<%--<script defer="defer">

var ads = new Array();
ads[0]="金融";
ads[1]="文学";
ads[2]="法律";
ads[3]="建筑";
ads[4]="园艺";
ads[5]="娱乐";
ads[6]="艺术";
ads[7]="计算机";


var dhcomb = new dhCombobox();
 dhcomb.clsName = "dhcomb";
 dhcomb.targetObj = document.getElementById("TextBox3");
 dhcomb.arrayData = ads;
dhcomb.setup();

ads = null;

</script>
--%>
</html>
